package cn.dengta.webapp.im.form;

import java.util.List;

import cn.dengta.common.model.Status;
import cn.dengta.common.util.Common;
import cn.dengta.common.validator.Check;
import cn.dengta.webapp.base.form.BaseForm;
import cn.dengta.webapp.im.entity.GroupVerifyLog;
import lombok.*;
import me.codeplayer.util.*;

@Getter
@Setter
public class GroupVerifyForm extends BaseForm<Void> {

	@Check(value = "status", i18n = false)
	public Integer status;
	public String remark;
	@Check(value = "原因ID", required = false, i18n = false)
	public Long remarkId;
	public GroupVerifyLog.VerifyType verifyType;
	@Setter(AccessLevel.NONE)
	public List<Long> ids;
	public Long orderId;

	@Override
	public void validate() {
		Assert.isTrue(X.isValid(ids), "ID不能为空！");
		Assert.notTrue(!Status.asResult(status) && StringUtil.isEmpty(remark), "审核意见不能为空！");
	}

	public void setType(Integer type) {
		this.verifyType = Cmp.eq(GroupVerifyLog.VerifyType.GROUP.value, type) ? GroupVerifyLog.VerifyType.GROUP : GroupVerifyLog.VerifyType.GROUP_DATA;
	}

	public void setIds(String ids) {
		this.ids = Common.splitAsLongList(ids);
	}

}
